﻿//-----------------------------------------------------------------------
// <copyright file="UserLogValidation.cs" company="O-RID">
//     Copyright (c)2010 O-RID Co.,Ltd.
// </copyright>
// <author>zhangjun</author>
// <summary>公有类  用于存储或是转换服务端传来的数据</summary>
//-----------------------------------------------------------------------

namespace Orid.Management.Statistics.OperatorUnitMangement.Common.FunctionList
{
    using System.ComponentModel.DataAnnotations;    

    #region  登录的数据验证
    /// <summary>
    /// 登录的数据验证类 UserLogValidation
    /// </summary>
    public class UserLogValidation 
    {
        /// <summary>
        /// 验证用户名 userNameValidation
        /// </summary>
        private string userNameValidation;

        /// <summary>
        /// 验证密码 passWordValidation
        /// </summary>
        private string passWordValidation;

        /// <summary>
        /// Gets or sets value of userNameValidation
        /// 验证用户名 UserNameValidation
        /// </summary>
        [Display(Name = "用户ID:", Description = "必填字段")]
        [Required(ErrorMessage = "用户ID不能为空项")]
        public string UserNameValidation
        {
            get 
            { 
                return this.userNameValidation; 
            }

            set
            {
                /*
                * Validator.ValidateProperty() - 用于决定指定的属性是否通过了验证（根据属性的 DataAnnotations 的 Attribute 做判断）。以及当其没有通过验证时，抛出异常
                */
                Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "UserNameValidation" });
                this.userNameValidation = value;            
            }
        }

        /// <summary>
        /// Gets or sets value of passWordValidation
        /// 验证密码 PassWordValidation
        /// </summary>
        [Display(Name = "密    码:", Description = "必填字段")]
        [Required(ErrorMessage = "密码长度不为0")]
        public string PassWordValidation
        {
            get 
            { 
                return this.passWordValidation; 
            }

            set
            {
                Validator.ValidateProperty(value, new ValidationContext(this, null, null) { MemberName = "PassWordValidation" });
                this.passWordValidation = value;
            }
        }
    }
    #endregion 登录的数据验证
}
